package com.dz.message.service.impl;

import java.util.Date;

import com.dz.message.entity.Message;
import com.dz.message.mapper.MessageDao;
import com.dz.message.service.MessageService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 * 短信发送记录表 服务实现类
 * </p>
 *
 * @author star
 * @since 2017-07-01
 */
@Service
public class MessageServiceImpl extends ServiceImpl<MessageDao, Message> implements MessageService {

	public Message addMsg(String num, String code, boolean success) {
		Message message = new Message();
		message.setMobile(num);
		message.setType(0);
		message.setSendDate(new Date());
		message.setStatus(success ? "success" : "fail");
		message.setMsg(code);
		insert(message);
		return message;
	}

}
